{% extends "base.html" %}
{% load i18n %}
{% block title %}{% blocktrans %}{{ user }}'s Dashboard{% endblocktrans %}{% endblock %}
{% block customjs %}
<script type="text/javascript" src="{{ MEDIA_URL }}js/ui.datepicker.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.profile.js"></script>
<link rel="stylesheet" href="{{ MEDIA_URL }}css/ui.datepicker.css" type="text/css" />
{% ifequal LANGUAGE_CODE 'es' %}
<script type="text/javascript" src="{{ MEDIA_URL }}js/ui.datepicker-{{ request.LANGUAGE_CODE }}.js"></script>
<script type="text/javascript">
	$(function() {
		$.datepicker.setDefaults($.datepicker.regional["{{ request.LANGUAGE_CODE }}"]);
	});
</script>
{% endifequal %}
{% endblock %}

{% block content %}
{% load userprofile_tags %}
<h1>{% trans "Tell others something about you" %}</h1>
<form class="commonform profile" action="" method="post" enctype="multipart/form-data">
  <fieldset>
		<div class="save">
			<img style="float: right;" class="saving" src="{{ MEDIA_URL }}images/loading3.gif" />
   		<input type="button" class="save" value="{% trans 'Save' %}" />
		</div>
		<div>
    	<label for="id_username">{% trans "Username:" %}</label>
    	<strong id="id_username">{{ user }}</strong> 
			<a href="/accounts/password/change">{% trans "(Change password)" %}</a>
		</div>
		<div>
    	<label for="id_email">{% trans "E-mail:" %}</label>
    	<strong id="id_email">{%if not email %}{% trans "Not set yet" %}{% else %}{{ email }}{% endif %}</strong> 
			(<a href="/accounts/email/change">{% if email %}{% trans "Change your e-mail address" %}{% else %}{% trans "Add your e-mail address" %}{% endif %}</a>)
		</div>
		<div>
   		<label for="id_avatar">{% trans "Avatar:" %}</label>
			<div class="avatar">
				<a class="newavatar img" href="/profile/avatar/choose/">
     			{% if user.avatar %}
     			<img id="avatarimg" src="{{ user|avatar:"96"}}" />
     			{% else %}
     			<img id="avatarimg" src="{{ MEDIA_URL }}images/default.gif" />
     			{% endif %}
				</a>
   			<a class="newavatar" href="/profile/avatar/choose/">{% trans "Change" %}</a> <a class="delavatar" href="/profile/avatar/delete">{% trans "Delete" %}</a>
			</div>
		</div>
		<hr />
		<div>
    	<label for="id_firstname">{% trans "First Name:" %}</label>
    	{{ form.firstname }}
		</div>
		<div>
    	<label for="id_surname">{% trans "Surname:" %}</label>
    	{{ form.surname }}
		</div>
		<div>
    	<label for="id_gender">{% trans "Gender:" %}</label>
			<a class="male" href="{{ request.path }}">{% trans "Male" %}</a>
			<a class="female" href="{{ request.path }}">{% trans "Female" %}</a>
		</div>
		<div>
   		<label for="id_birthdate">{% trans "Birth date:" %}</label>
			<div class="calendar"></div>
		</div>
		<hr />
		<div>
    	<label for="id_url">{% trans "Url:" %}</label>
    	{{ form.url }}
		</div>
		<div>
    	<label for="id_about">{% trans "About:" %}</label>
    	{{ form.about }}
		</div>
		<hr />
		<div>
   		<label for="id_country">{% trans "Country:" %}</label>
			<select name="country" id="id_country">
				<option value="">{% trans "Not set" %}</option>
				<option value="" disabled="disabled">{% trans "More common..." %}</option>
				<option value="ES">{% trans "Spain" %}</option>
				{% for continent,countries in country_data.items %}
					<option value="" disabled="disabled">{{ continent }}</option>
					{% for country in countries %}
					<option value="{{ country.code }}" {% ifequal profile.country country%}selected="selected"{% endifequal %}>{{ country }}</option>
					{% endfor %}
				{% endfor %}
			</select>
			<img class="loading" src="{{ MEDIA_URL }}images/loading.gif" />
		</div>
		<div class="mapinfo">
   		<label for="id_location">{% trans "Location:" %}</label>
			<input style="width: 600px;" id="id_location" type="text" readonly="readonly" name="location" maxlength="255" value="{{ profile.location }}" /> 
		</div>
		<div class="mapinfo">
   		<label for="id_position">{% trans "Position:" %}</label>
			<div id="map"></div>
		</div>
		<hr />
		<div>
    	<label for="id_other">{% trans "Other actions:" %}</label>
    	<strong><a href="/profile/delete">{% trans "Delete all my personal information" %}</a></strong>
		</div>
    <div style="display: none;">{{ form.birthdate }}{{ form.latitude }}{{ form.longitude }}{{ form.gender }}</div>
		<div class="save">
   		<input type="button" style="float: right;" class="save" value="{% trans 'Save' %}" /><img style="float: left;" class="saving" src="{{ MEDIA_URL }}images/loading3.gif" />
		</div>
  </fieldset>
</form>
<div style="display: none;" id="apikey">{{ APIKEY }}</div>
{% endblock %}
